﻿@{
    ViewBag.Title = "保单详情";
    var id = Model != null ? Model.ID : 0;
}
@using ZBJF.Warranty.Common.Enums.Certificate
@using ZBJF.Warranty.Common.Enums.InsuranceOrder
@model ZBJF.Warranty.Model.InsuranceOrder
<ul class="nav nav-tabs">
    <li class="active"><a href="/InsuranceOrder/Detail/@id">保单详情</a></li>
</ul>
@using (Html.BeginForm("AuditInsuranceOrder", "InsuranceOrder", FormMethod.Post, new { id = "mvcForm", name = "mvcForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.ID)
    <!--最后修改时间。用于做尺度审核的并发控制，防止审核期间订单发生变化-->
    @Html.HiddenFor(c => c.LastModifyTime)
    <table class="table table-responsive table-bordered table-hover">
        <tr><th colspan="4" class="group-header">订单信息</th></tr>
        <tr>
            <th>工单号：</th>
            <td>
                @Html.DisplayFor(o => o.OrderNO)
            </td>
            <th>工单状态：</th>
            <td class="red">
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderStatus), Model.OrderStatus)
            </td>
        </tr>
        <tr>
            <th>第三方承保公司：</th>
            <td>
                @Html.DisplayFor(o => o.InsuranceCompany)
            </td>
            <th>第三方保单号：</th>
            <td>
                @Html.DisplayFor(o => o.ThirdOrderNO)
            </td>
        </tr>
        <tr>

            <th>承保公司分公司：</th>
            <td>
                @Html.DisplayFor(o => o.InsuranceCompanyBranch)
            </td>
            <th>投保时间：</th>
            <td>
                @Html.DisplayFor(o => o.CreateOrderTime)
            </td>
        </tr>
        <tr>
            <th>保险产品类别</th>
            <td>
                @Html.DisplayFor(o => o.InsuranceCategoryName)
            </td>
            <th>保险产品：</th>
            <td>
                @Html.DisplayFor(o => o.ProductName)
            </td>
        </tr>
        <tr>
            <th>校验凭证：</th>
            <td>
                @Html.DisplayFor(o => o.VerificationCertificate)
            </td>
            <th>激活卡卡号：</th>
            <td>
                @Html.DisplayFor(o => o.CardNo)
            </td>
        </tr>
        <tr>
            <th>工单来源：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderFromType), Model.OrderFromType)
            </td>
            <th>购买方式：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceBuyType), Model.BuyType)
            </td>
        </tr>
        <tr>
            <th>保险价格：</th>
            <td>
                @Html.DisplayFor(o => o.Price)
            </td>
            <th>保额：</th>
            <td>
                @Html.DisplayFor(o => o.InsuredAmount)
            </td>
        </tr>
        <tr>
            <th>保险期限：</th>
            <td>
                @Html.DisplayFor(o => o.PolicyPeriod)
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderPeriodUnit), Model.PolicyPeriodUnit)
            </td>
            <th>生效等待天数：</th>
            <td>
                @Html.DisplayFor(o => o.WaitDays) 天
            </td>
        </tr>
        <tr>
            <th>保险起期：</th>
            <td>
                @Html.DisplayFor(o => o.ServiceStartTime)
            </td>
            <th>保险止期：</th>
            <td>
                @Html.DisplayFor(o => o.ServiceEndTime)
            </td>
        </tr>
        <tr>
            <th>最后审核时间：</th>
            <td>
                @Html.DisplayFor(c => c.LastCheckTime)
            </td>
            <th>最后审核人：</th>
            <td>
                @Html.DisplayFor(c => c.LastCheckUser)
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">用户信息</th></tr>
        <tr>
            <th>被保险人：</th>
            <td>
                @Html.DisplayFor(o => o.UserName)
            </td>
            <th>被保险人电话：</th>
            <td>
                @Html.DisplayFor(o => o.UserPhone)
            </td>
        </tr>
        <tr>
            <th>证件类型：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(UserCertificateType), Model.CertificateType)
            </td>
            <th>证件号码：</th>
            <td>
                @Html.DisplayFor(o => o.CertificateNO)
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">被保险设备信息</th></tr>
        <tr>
            <th>被保险设备：</th>
            <td>
                @Html.DisplayFor(o => o.ProductTypeName)
            </td>
            <th>设备识别码：</th>
            <td>
                @Html.DisplayFor(o => o.IMEI)
            </td>
        </tr>
        <tr>
            <th>UUID：</th>
            <td>
                @Html.DisplayFor(o => o.IDFV)
            </td>
            <th>产品品牌名称：</th>
            <td>
                @Html.DisplayFor(o => o.ProductBrandName)
            </td>
        </tr>
        <tr>
            <th>产品型号：</th>
            <td>
                @Html.DisplayFor(o => o.ProductModelName)
            </td>
            <th></th>
            <td></td>
        </tr>
        <tr><th colspan="4" class="group-header">销售信息</th></tr>
        <tr>
            <th>销售商户名称：</th>
            <td>
                @Html.DisplayFor(o => o.SaleVendorName)
            </td>
            <th>销售人姓名：</th>
            <td>
                @Html.DisplayFor(o => o.SalePersonName)
            </td>
        </tr>
        <tr>
            <th>负责人姓名：</th>
            <td>
                @Html.DisplayFor(o => o.SaleManagerName)
            </td>
            <th>负责人电话：</th>
            <td>
                @Html.DisplayFor(o => o.SaleManagerPhone)
            </td>
        </tr>
        <tr>
            <th>销售商地址：</th>
            <td colspan="3">
                @Html.DisplayFor(o => o.SaleAddress)
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">图片</th></tr>
        <tr>
            <td colspan="4">
                <table class="w-p100">
                    <tr>
                        <th width="20">序号</th>
                        <th width="300">上传时间</th>
                        <th>图片</th>
                    </tr>
                    @{
                        var imgList = Model.InsuranceOrderImage.ToList();
                    }
                    @for (int i = 0; i < imgList.Count; i++)
                    {
                        <tr>
                            <td>
                                @(i + 1)
                            </td>
                            <td>
                                @imgList[i].CreateTime
                            </td>
                            <td>
                                <a target="_blank" href="@imgList[i].ImageUrl">点击查看</a>
                            </td>
                        </tr>
                    }
                </table>
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">审核信息</th></tr>
        <tr>
            <td colspan="4">
                <table class="w-p100">
                    <tr>
                        <th width="20">序号</th>
                        <th width="100px">审核结果</th>
                        <th>备注</th>
                        <th width="230px">检测时间</th>
                        <th width="166px">检测人</th>
                    </tr>
                    @for (int i = 0; i < Model.InsuranceOrderCheckLog.Count; i++)
                    {
                        <tr>
                            <td>
                                @(i + 1)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckResult ? "审核通过" : "审核未通过")
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckRemark)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckTime)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckUserName)
                            </td>
                        </tr>
                    }
                </table>
            </td>
        </tr>
        @if (Model.OrderStatus == (byte)InsuranceOrderStatus.Create || Model.OrderStatus == (byte)InsuranceOrderStatus.ApprovedButNotPassed)
        {
            <tr>
                <td colspan="4">
                    审核是否通过：
                    @Html.DropDownList("CheckResult", ZBJF.Warranty.WebProvider.ConvertToSelector.Instance.InitSelectList(true), new { validate = "{required:true}" })
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    审核备注：
                    <textarea id="CheckRemark" name="CheckRemark" style="width: 99%" class="form-control"></textarea>
                </td>
            </tr>
        }
    </table>
    if (Model.OrderStatus == (byte)InsuranceOrderStatus.Create || Model.OrderStatus == (byte)InsuranceOrderStatus.ApprovedButNotPassed)
    {
        <div class="form-actions">
            <input id="btnAuditAndPass" class="btn btn-primary Edit-R" type="submit" value="提交">
        </div>
    }
}
@section scripts
{
    @Scripts.Render("~/Bundles/ImagePreview")
    <script type="text/javascript">
        $(function () {
            $("img.preview").preview();
            $("#insuranceOrderCheckLogDiv").show();
        });
    </script>
}
